<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('申请开票列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>客户名称：</label>
                            <input type="text" name="customerName"/>
                        </li>

                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('work:invoice:edit')}]];
    var removeFlag = [[${@permission.hasPermi('work:invoice:remove')}]];
    var invoiceTypeDatas = [[${@dict.getType('work_invoice_type')}]];
    var invoiceCompanyDatas = [[${@dict.getType('work_invoice_company')}]];
    var bankNoDatas = [[${@dict.getType('work_bank')}]];
    var isContractDatas = [[${@dict.getType('work_yes_no')}]];
    var prefix = ctx + "work/invoice";

    $(function () {
        var options = {
            url: prefix + "/cancel",
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            columns: [{
                checkbox: true
            },
                {
                    field: 'invoiceId',
                    title: '发票ID'
                },
                {
                    field: 'invoiceType',
                    title: '发票类型',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(invoiceTypeDatas, value);
                    }
                },
                {
                    field: 'invoiceTitle',
                    title: '发票抬头'
                },
                {
                    field: 'customerName',
                    title: '客户名称'
                },
                {
                    field: 'invoiceCompany',
                    title: '开哪个公司',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(invoiceCompanyDatas, value);
                    }
                },
                {
                    field: 'invoiceContent',
                    title: '开票内容'
                },
                {
                    field: 'invoicePrice',
                    title: '开票稿件合作金额'
                },
                {
                    field: 'paperPrice',
                    title: '已选稿件金额'
                },
                {
                    field: 'taxPoint',
                    title: '税点'
                },
                {
                    field: '',
                    title: '税金',
                    formatter: function (value, row, index) {
                        return row.invoicePrice * row.taxPoint / 100;
                    }
                },
                {
                    field: 'taxPoint',
                    title: '价税合计',
                    formatter: function (value, row, index) {
                        return row.invoicePrice+(row.invoicePrice * row.taxPoint / 100);
                    }
                },
                {
                    field: 'payback',
                    title: '客户还款'
                },
                {
                    field: 'taxNo',
                    title: '税务登记证号'
                },
                {
                    field: 'bankNo',
                    title: '基本开户银行',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(bankNoDatas, value);
                    }
                },
                {
                    field: 'bankAccount',
                    title: '开户银行账号'
                },
                {
                    field: 'isContract',
                    title: '合同',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(isContractDatas, value);
                    }
                },
                {
                    field: 'contractDate',
                    title: '合同收集日期'
                },
                {
                    field: 'registerAddress',
                    title: '注册场所地址'
                },
                {
                    field: 'registerTel',
                    title: '注册场所电话'
                },
                {
                    field: 'remark',
                    title: '其它要求'
                }]
        };
        $.table.init(options);
    });
    /* 添加用户-选择用户-提交(回调形式-父页面调用子页面) */
    function getSelections() {
        //return $.table.selectFirstColumns();

        var row = $("#bootstrap-table").bootstrapTable('getSelections');
        return row;
    }
</script>
</body>
</html>